package com.unsiv.torch;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.ImageView;

/**
 * <p>
 * start activity
 * </p>
 * @author fanzhen
 * @time 7:31:13 PM Aug 26, 2011
 * @email fanzhen.meng@gmail.com
 */
public class NavigateFinish extends Activity {
	private ImageView goon;
	private ImageView agine;
	private String type;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		this.setContentView(R.layout.navigate_finish);
		goon = (ImageView)findViewById(R.id.goon);
		agine = (ImageView)findViewById(R.id.agine);
		Intent intent = getIntent();
		type = intent.getStringExtra("type");
		goon.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				if ("screen".equals(type)) {
					Intent intent = new Intent(getApplicationContext(),ScreenTorch.class);
					startActivity(intent);
				} else {
					Intent intent = new Intent(getApplicationContext(),LedTorch.class);
					startActivity(intent);
				}
			}
		});
		agine.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(getApplication(),Navigate.class);
				intent.putExtra("type",type);
				startActivity(intent);
			}
		});
	}
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(0, 0, 0, "Exit");
		return true;
	}
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case 0:
			MyCamaraHelper.turnOff();
			new ActivityUtil(this).exit();
			return true;
		}
		return false;
	}
}